//package cn.nfwx.tv.controller;
//
//import android.content.Context;
//import android.widget.Toast;
//
//import cn.nfwx.tv.callback.ResponseListener;
//import cn.nfwx.tv.helper.AccountHelper;
//import cn.nfwx.tv.helper.ThreadHelper;
//import cn.nfwx.tv.manager.AppointmentManager;
//import cn.nfwx.tv.model.TVProgramModel;
//import cn.nfwx.tv.util.DialogUtil;
//import cn.nfwx.tv.util.SharePrefUtil;
//
///**
// * 用户操作 , 设计预约预定 , 订阅， 下载 等
// * Created by zhouzechao on 2017/12/14.
// */
//
//public class AccountController {
//
//    /**
//     * 用户操作预约信息
//     *
//     * @param context
//     * @param programModel
//     */
//    public static void appointment(final Context context, final TVProgramModel programModel) {
//        if (AccountHelper.getInstance().isLogin(context)) {
//            DialogUtil.showLoadingProgress(context);
//            AppointmentManager.makeAppointment(context, programModel.getLiveId(), programModel.getLiveName(), programModel.getTitle(), programModel.getTime() * 1000 + "", SharePrefUtil.getAccessToken(context), new ResponseListener<String>() {
//                @Override
//                public void onResponse(String tag, final String response) {
//                    ThreadHelper.post(new Runnable() {
//                        @Override
//                        public void run() {
//                            DialogUtil.cancleLoadingProgress();
//                            Toast.makeText(context, "预约成功", Toast.LENGTH_LONG).show();
////                            AppiontmentModel model = new AppiontmentModel();
////                            model.setTime(TimeUtil.timeToDate(programModel.getTime()));
////                            model.setLid(programModel.getLiveId());
////                            model.setLiveName(programModel.getLiveName());
////                            model.setName(programModel.getTitle());
////                            model.setPlayPath(programModel.getPath());
////                            AppiontmentDao dao = new AppiontmentDao(context);
////                            dao.add(model);
//                        }
//                    });
//                }
//
//                @Override
//                public void onError(String tag, final Throwable t) {
//
//                    ThreadHelper.post(new Runnable() {
//                        @Override
//                        public void run() {
//                            DialogUtil.cancleLoadingProgress();
//                            Toast.makeText(context, "预约失败", Toast.LENGTH_LONG).show();
//                        }
//                    });
//                }
//
//                @Override
//                public void onFinish() {
//                }
//            });
//        } else {
//            Toast.makeText(context, "请先登录,再预约节目", Toast.LENGTH_LONG).show();
//        }
//    }
//
//}
